Skip to content

feat(proxies): CLI proxy workroots -> ~/.local/state/cli-proxies - #2782

Merged
dezren39 merged 1 commit into
mainfrom
proxy/cli-workdir-state-dir
Oct 30, 2026
Merged

dezren39 merged 1 commit into
mainfrom
proxy/cli-workdir-state-dir

Conversation

@dezren39

@dezren39 dezren39 commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Problem

muse-proxy, commandcode-proxy and claude-code-proxy all default their workroot to bin/work inside the ~/code checkout (path.join(PROXY_DIR, 'work')). Muse writes warm-sessions.json + prompt files there; CommandCode creates sessions/<hash> + acp-project; Claude Code creates sessions/<hash>. That runtime state dirties the primary checkout continuously (a tracked warm-sessions.json is rewritten live) and is what blocks pm-git-sync from resuming.

Change

All three scripts already honour a *_PROXY_WORKDIR override (MUSE_PROXY_WORKDIR, COMMANDCODE_PROXY_WORKDIR, CLAUDE_CODE_PROXY_WORKDIR). This sets each on its home-manager user unit in home/common/default.nix to the one shared state dir %h/.local/state/cli-proxies, plus a comment recording why. No script changes; no other units touched.

Deploy (post-merge, proxy lane)

  1. Copy the current ~/code/bin/work contents (128M: warm-session map + session workdirs) into ~/.local/state/cli-proxies BEFORE restarting the services, so warm sessions and existing session work survive.
  2. Activate home-manager from a clean worktree at origin/main (activationPackage route), restart the three units, verify each logs the new workroot and its port (18747/18748/18749) stays healthy.
  3. Move the in-repo residue out (preserved, not deleted) and remove the tracked leftovers under bin/work in a follow-up cleanup PR.

Explicitly NOT a .gitignore fix, per Drew's 2026-10-29 call: session dirs can hold real work products - they get preserved/moved, never hidden. Approved by Drew in Repo sweeps 2026-10-30.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

Summary by CodeRabbit

  • Bug Fixes
    • Command Code, Claude Code, and Muse proxies now store session data in a shared user state directory instead of the checkout’s working directory.

muse-proxy, commandcode-proxy and claude-code-proxy default their workroot to bin/work inside the ~/code checkout, so every warm session and per-conversation workdir dirties the primary checkout and blocks pm-git-sync. All three scripts already honour a *_PROXY_WORKDIR override; set it on the three home-manager user units to the shared state dir %h/.local/state/cli-proxies (runtime state preserved/moved at deploy time, per Drew 2026-10-29/30 - not a gitignore fix).
@dezren39
dezren39 requested a review from a team as a code owner October 30, 2026 15:40
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T15:44:15.641207Z edab2d2 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Caution

Review failed

The pull request is closed.

Walkthrough

The Command Code, Claude Code, and Muse proxy services now set their respective work directory environment variables to %h/.local/state/cli-proxies. A comment documents this shared runtime state path.

Changes: Proxy work directory configuration

Layer / File(s) Summary
Set proxy work directories
home/common/default.nix
The three proxy service environments set their work directory variables to %h/.local/state/cli-proxies. A comment documents the path’s use for runtime session state.

Priority: Not assessed

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Merge Risk: Minimal · up to edab2

The change relocates the three proxy workroots without introducing a demonstrated runtime regression. It is mergeable with normal checks and the planned state-directory migration.

Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@dezren39
dezren39 merged commit 35c4c9c into main Oct 30, 2026
1 check failed
@dezren39
dezren39 deleted the proxy/cli-workdir-state-dir branch October 30, 2026 15:46
dezren39 pushed a commit that referenced this pull request Oct 30, 2026
Follow-up to #2782: the nine files under bin/work are CLI-proxy runtime state (warm-session map, per-session workdir products) that was committed accidentally and then kept dirtying the primary checkout as the proxies rewrote it live. The proxies now run with their workroots in ~/.local/state/cli-proxies; the on-disk state was copied there and the in-repo residue moved out preserved (never deleted, never gitignored, per Drew 2026-10-29/30). Nothing in the repo references bin/work.
dezren39 added a commit that referenced this pull request Oct 31, 2026
…#3067)

The commandcode + claude-code session map was anchored to PROXY_DIR (bin/sessions.json), so the #2782 workdir move to ~/.local/state/cli-proxies missed it and the tracked checkout kept dirtying with every session write, blocking pm-git-sync.

- commandcode-proxy: add COMMANDCODE_PROXY_SESSION_FILE override (mirrors claude-code pattern); default resolves to the shared state root sessions.json.
- claude-code-proxy: SESSION_FILE default moves from PROXY_DIR to the same shared state-root path; env override kept. Both proxies share one map (mirrored key space) so both must resolve to the same file.
- home/common: pin COMMANDCODE_PROXY_SESSION_FILE and CLAUDE_CODE_PROXY_SESSION_FILE to %h/.local/state/cli-proxies/sessions.json on both units, alongside the existing *_PROXY_WORKDIR pins.

Codex audit: bin/codex-proxy.mjs already resolves sessions.json via sessionStateDir() = $XDG_STATE_HOME/codex-proxy or ~/.local/state/codex-proxy -- outside the checkout, no change needed. muse-proxy uses warm-sessions.json under WORKDIR (moved by #2782), untouched.

No .gitignore entry for bin/sessions.json, by design: after this fix nothing may write there, and dirt in the primary checkout is the regression tripwire.

Verified: node --check on both proxies; node --test bin/commandcode-proxy.test.mjs (1 pass) and bin/claude-code-proxy.test.mjs (5 pass); nix-instantiate --parse home/common/default.nix rc=0; default path expression resolves to /home/user/.local/state/cli-proxies/sessions.json.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant